import cv2
from cv2 import cornerSubPix
from matplotlib.pyplot import gray
import numpy as np

img = cv2.imread("E:\\chess.png")

# 灰度化
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

# 创建sift对象
sift = cv2.SIFT_create()
kp = sift.detect(gray, None) # 第二个参数为mask区域

# 绘制角点，第三个参数为在那张图上进行绘制
cv2.drawKeypoints(gray, kp, img)

cv2.imshow('img',img)
cv2.waitKey(0)